#include "qmenubutton.h"
#include <QMenu>

QMenuButton::QMenuButton(QWidget *parent) :
    QPushButton(parent)
{
    menu = new QMenu(this);
    connect(this,SIGNAL(clicked()),this,SLOT(popupmenu()));
}
QMenu *QMenuButton::getmenu()
{
     return menu;
}

void QMenuButton::popupmenu()
{   
    QPoint pos;
    int y = pos.y();
    pos.setY(y+this->geometry().height());
    menu->popup(this->mapToGlobal(pos));
    //menu->exec();
}
